<template>
  <div class="panel">
    <div class="panel-header">
      <div class="panel-tabs">
        <div
          class="panel-tab"
          :class="item.type === tab ? 'active' : ''"
          v-for="item in tabs"
          :key="item.type"
          @click="changeTab(item.type)"
        >
          {{ item.title }}
        </div>
      </div>
    </div>
    <div class="panel-body">
      <div v-if="tab === 'modelTree'">
        <model-tree />
      </div>
      <div v-else>
        <lens />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import lens from './lens.vue';
import ModelTree from './model-tree.vue';

const tab = ref('lens');

const tabs = [
  {
    type: 'lens',
    title: '效果',
  },
  {
    type: 'modelTree',
    title: '模型树',
  },
];

const changeTab = (newTab: string) => {
  tab.value = newTab;
};
</script>

<style lang="less" scoped>
.panel {
  width: 100%;

  .panel-body {
    height: calc(100% - 30px);
    padding: 10px 0;
    overflow: auto;
  }
}
</style>
